<template>
  <div class="background">
    <a-tabs default-active-key="1" size="large" @change="tabsChange">
      <a-tab-pane v-for="(item, index) in tabOption" :key="item.key_value" :tab="item.key_name">
        <component ref="childComponentRef" :is="item.component" />
      </a-tab-pane>
    </a-tabs>
  </div>
</template>

<script>
import day from './day.vue'
import month from './month.vue'
export default {
  components: {
    day,
    month,
  },
  data() {
    return {
      tabOption: [
        {key_value: '1', key_name: '日报表', component: 'day'},
        {key_value: '2', key_name: '月报表', component: 'month'},
      ],
      importVisible: false
    }
  },
  mounted() {
  },
  methods: {
    tabsChange(){
      // 获取对子组件的引用
      const childComponent = this.$refs.childComponentRef;
      childComponent.forEach((item) => {
        item.searchQuery()
      })
    }
  }
}
</script>

<style>
.background {
  padding: 0 15px;
  background-color: white;
  border-radius: 5px;
  box-shadow: 1px 4px 4px rgba(0, 0, 0, 0.05);
}
</style>
